import http from '@/plugins/axios'

export function getCusSerList() {
  return http({
    method: 'POST',
    url: '/sys/user/cusSerList',
    data: {
      condition: {},
      page: {
        index: 1,
        size: 999999999999
      },
      sort: { order: '', sidx: '' }
    }
  }).then(res => {
    return res.list || []
  })
}


export function getCustomerList() {
  return http({
    method: 'POST',
    url: '/ykf/customer/selectPage',
    data: {
      condition: {},
      page: {
        index: 1,
        size: 999999999999
      },
      sort: { order: '', sidx: '' }
    }
  }).then(res => {
    return res.list.map(i => ({ value: i.customerId, label: i.customerName }))
  })
}

export function getShopList(data) {
  return http({
    method: 'POST',
    url: '/ykf/customerShop/page',
    data: {
      condition: {
        customerId: data.customerId
      },
      page: {
        index: 1,
        size: 999999999999
      },
      sort: { order: '', sidx: '' }
    }
  }).then(res => {
    return res.list.map(i => ({ label: i.shopName, value: i.shopId }))
  })
}

export function getCustomerSubAccountList(data) {
  return http({
    method: 'POST',
    url: '/ykf/customerSubAccount/selectPage',
    data: {
      condition: {
        shopId: data.shopId
      },
      page: {
        index: 1,
        size: 999999999999
      },
      sort: { order: '', sidx: '' }
    }
  }).then(res => {
    return res.list.map(i => ({ label: i.accountName, value: i.subAccountId }))
  })
}

export function getScriptManagePage(data) {
  return http({
    method: 'POST',
    url: '/ykf/workOvertimeRecord/page',
    data
  })
}

export function addScriptManagePage(data) {
  return http({
    method: 'POST',
    url: '/ykf/workOvertimeRecord/save',
    data
  })
}

export function updateScriptManagePage(data) {
  return http({
    method: 'POST',
    url: '/ykf/workOvertimeRecord/update',
    data
  })
}

export function removeScriptManagePage(data) {
  return http({
    method: 'POST',
    url: '/ykf/workOvertimeRecord/delete',
    data
  })
}
